From d47a8e863a56c4e2db18198ebfe21100be086b77 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Tue, 1 Dec 2009 13:49:33 +0000 Subject: [PATCH] libxenlight: enables less than maximum vcpus Enable turning on a different amount of vcpus than the maximum during domain creation/restore. Signed-off-by: Andres Lagar-Cavilla --- tools/libxl/libxl.h | 1 + tools/libxl/libxl_dom.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 7a215e7d7e..dd3d6dbe1e 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -64,6 +64,7 @@ typedef struct { int hpet; int vpt_align; int max_vcpus; + int cur_vcpus; uint32_t max_memkb; uint32_t video_memkb; uint32_t shadow_memkb; diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index 6535890368..aeb96d4e3c 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -88,7 +88,8 @@ int build_post(struct libxl_ctx *ctx, uint32_t domid, ents[9] = libxl_sprintf(ctx, "%lu", state->store_mfn); for (i = 0; i < info->max_vcpus; i++) { ents[10+(i*2)] = libxl_sprintf(ctx, "cpu/%d/availability", i); - ents[10+(i*2)+1] = "online"; + ents[10+(i*2)+1] = (i && info->cur_vcpus && (i >= info->cur_vcpus)) + ? "offline" : "online"; } dom_path = libxl_xs_get_dompath(ctx, domid); -- 2.30.2